package and.roid.box;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;

public class BoxGamen {
	private int gamen_x, gamen_y, gamen_w, gamen_h, gamen_col;

	private static final int BOX_WH = 100, BOX_D = 360;
	private List<BoxOb> listBoxs = new ArrayList<BoxOb>();

	BoxGamen(int x, int y, int w, int h, int col) {
		gamen_x = x;
		gamen_y = y;
		gamen_w = w;
		gamen_h = h;
		gamen_col = col;
	}

	public void init(int x, int y) {
		Random r = new Random(new Date().getTime());
		int wh = r.nextInt(BOX_WH) + 5;
		int d = r.nextInt(BOX_D);
		int col = Color.rgb(r.nextInt(240) + 10, r.nextInt(240) + 10, r.nextInt(240) + 10);
		int vxy = r.nextInt(20) + 5;
		listBoxs.add(new BoxOb(x, y, wh, d, vxy, col));
	}

	public void draw(Canvas c, Paint p, boolean start) {
		p.setStyle(Paint.Style.STROKE);
		p.setColor(Color.BLACK);
		c.drawRect(new Rect(gamen_x, gamen_y, gamen_w, gamen_h), p);
		for(BoxOb boxOb : listBoxs){
			boxOb.draw(c, p);
			boxOb.move(gamen_x, gamen_y, gamen_w, gamen_h);
		}
	}

	public void Reset() {
		listBoxs.clear();
	}
}
